<?php
class Application_Form_Book extends Application_Form_Object
{
	public function __construct($options = null)
    {
        parent::__construct($options);
		$this->setName('Book');
		
		
		$author = new Zend_Form_Element_Text('author');
		$author->setLabel('Author:')
		->setRequired(true)
		->setFilters(array('StringTrim','StripTags'))
		->setValidators(array('NotEmpty'));
		
		$catBookChoice = array(		'1' => 'Politic',
								 	'2' => 'literature',
									'3' => 'Art',
									'4' => 'BD',
									'5' => 'Dictionary',
									'6' => 'History',
									'7' => 'Computer',
									'8' => 'Manga',
									'9' => 'Religion',
									'10' => 'Scientific',
									'11' => 'Cooking',
								);
		$cat = new Zend_Form_Element_Select('category');
		$cat->setLabel('Category:');
		$cat->addMultiOptions(array('-1' => 'Choice:')+$catBookChoice);
		$cat->class = 'category';
		$cat->addValidator(new Zend_Validate_Between(array('min' => 1, 'max' => 11)))
		->addErrorMessage('You need to select one value');
		
		$submit = new Zend_Form_Element_Submit('submit');
		$submit->setAttrib('id', 'submitbutton')
		->setLabel('Add');
		
		$elements = array( $author, $cat,$submit );
		$this->addElements($elements);
		
		
		
		
		$this->setDecorators( array( array('ViewScript', array('viewScript' => 'forms/loginform.phtml'))));


		
	}
}